/*
 * Copyright (c) 2020, 2023, 3044483124@qq.com All rights reserved.
 *
 */
package cn.image;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;

/**
 * <p>Project: JavaStudy - ChangeImgType
 * <p>Powered by jiangbo On 2023-01-07
 * 09:28:31
 * <p>Created by IntelliJ IDEA
 *
 * @author jiangbo [3044483124@qq.com]
 * @version 1.0
 * @since 8/17
 */
public class ChangeImgType {
    public static void main(String[] args) throws Exception{
//cs.jpg 是webp格式的图像 原名为cs.webp
//使用dwebp cs.webp -o cs.jpg 将webp格式转换为jpg，就可以正常使用了。
String f = "C:\\Users\\30444\\Desktop\\截图\\wang_001.png";
BufferedImage img = ImageIO.read(new File(f));
System.out.println(img.getHeight());
//将其它图像转换为webp格式
        //Runtime run = Runtime.getRuntime();
//run.exec("cmd /c cwebp C:\\Users\\30444\\Desktop\\截图\\wang_001.png -o wang3.webp");
//将webp格式转换为其它图像
        //run.exec("cmd /c dwebp c:/t.webp -o c:/t.jpg");
        //run.exec("cmd /c dwebp c:/t.webp -o c:/t.png");
        //run.exec("cmd /c dwebp c:/t.webp -o c:/t.gif");
    }

}


